package cn.tedu.oa.basicInfo.controller;

import cn.tedu.oa.base.response.JsonResult;
import cn.tedu.oa.basicInfo.pojo.dto.BasicInfoQuery;
import cn.tedu.oa.basicInfo.pojo.dto.BasicInfoSaveParam;
import cn.tedu.oa.basicInfo.pojo.vo.BasicInfoVO;
import cn.tedu.oa.basicInfo.service.BasicInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/o1/basicInfo")
public class BasicInfoController {
    @Autowired
    BasicInfoService basicInfoService;
    @GetMapping("/select")
    public JsonResult select(BasicInfoQuery baseInfoQuery){
        log.debug("查询基础信息");
        List<BasicInfoVO> list = basicInfoService.select(baseInfoQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("/save")
    public JsonResult save(BasicInfoSaveParam baseInfoSaveParam){
        log.debug("新增信息"+baseInfoSaveParam);
        basicInfoService.save(baseInfoSaveParam);
        return JsonResult.ok();
    }
    @PostMapping("/delete/{id}")
    public JsonResult delete(@PathVariable Integer id){
        log.debug("删除信息"+id);
        basicInfoService.delete(id);
        return JsonResult.ok();
    }

}
